# cmake needs this line
cmake_minimum_required(VERSION 3.1)

# Define project name
project(CvDemo)

# Enable C++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

# Find OpenCV, you may need to set OpenCV_DIR variable
# to the absolute path to the directory containing OpenCVConfig.cmake file
# via the command line or GUI
# set(OpenCV_DIR "D:/Apps/opencv/build")   # Set OpenCV_DIR
# set(OpenCV_DIR "D:/sai/opencv/build")   # Set OpenCV_DIR
find_package(OpenCV REQUIRED )

# If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.
# Print some message showing some of them
message(STATUS "OpenCV library status:")
message(STATUS "    config: ${OpenCV_DIR}")
message(STATUS "    version: ${OpenCV_VERSION}")
message(STATUS "    libraries: ${OpenCV_LIBS}")
message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")

# eigen support
include_directories(
    ${EIGEN3_INCLUDE_DIR}
    ${ME_SOURCE_DIR}
    )

#file(COPY
#    ${CMAKE_CURRENT_SOURCE_DIR}/images/photo.png
#    DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/images/)

add_subdirectory(Core)
add_subdirectory(Calib)
add_subdirectory(IO)
add_subdirectory(Feature)
add_subdirectory(levmarq)

# Declare the executable target built from your sources
add_executable(cv_hellocv cv_hellocv.cpp)
target_link_libraries(cv_hellocv LINK_PRIVATE ${OpenCV_LIBS})

add_executable(cv_readimg cv_readimg.cpp)
target_link_libraries(cv_readimg LINK_PRIVATE ${OpenCV_LIBS})

add_executable(cv_imgproc cv_imgproc.cpp)
target_link_libraries(cv_imgproc LINK_PRIVATE ${OpenCV_LIBS})


### filestorage_sample
add_executable(cv_filestorage cv_filestorage.cpp)
target_link_libraries(cv_filestorage LINK_PRIVATE ${OpenCV_LIBS})

set(CV_CalibCommon
    CvCalibCommon.h
    CvCalibCommon.cpp
    CvCalib3D.h
    CvCalib3D.cpp
    )
### camera calibration
add_executable(cv_calibrate cv_calibrate.cpp)
target_link_libraries(cv_calibrate LINK_PRIVATE ${OpenCV_LIBS})

### camera stereo calibration
add_executable(cv_stereoCalib cv_stereoCalib.cpp
    ${CV_CalibCommon})
target_link_libraries(cv_stereoCalib LINK_PRIVATE ${OpenCV_LIBS})

### camera stereo calibration
add_executable(cv_stereoCal cv_stereoCal.cpp
    CvCalibCommon.h CvCalibCommon.cpp)
target_link_libraries(cv_stereoCal LINK_PRIVATE ${OpenCV_LIBS})

### tiny check 检查小距离移动识别
add_executable(cv_tinycheck cv_tinycheck.cpp
    CvCalibCommon.h CvCalibCommon.cpp)
target_link_libraries(cv_tinycheck LINK_PRIVATE ${OpenCV_LIBS})

### find contour/hull
add_executable(cv_DrawConvexHull cv_DrawConvexHull.cpp)
target_link_libraries(cv_DrawConvexHull LINK_PRIVATE ${OpenCV_LIBS})

add_executable(cv_CircleAndRectObj cv_CircleAndRectObj.cpp)
target_link_libraries(cv_CircleAndRectObj LINK_PRIVATE ${OpenCV_LIBS})
# Need set Path=D:\Apps\opencv\build\x64\vc15\bin
# For debug: set Path=D:\sai\opencv\build\bin\Debug

### find circle
add_executable(cv_findCircles cv_findCircles.cpp)
target_link_libraries(cv_findCircles LINK_PRIVATE ${OpenCV_LIBS})

### 标定CT 二维到三维的变化
add_executable(cvCalibCT cvCalibCT.cpp)
target_link_libraries(cvCalibCT LINK_PRIVATE ${OpenCV_LIBS} ${VTK_LIBRARIES})

### 单应矩阵精度分析
add_executable(cvHomographyPrecision cvHomographyPrecision.cpp)
target_link_libraries(cvHomographyPrecision LINK_PRIVATE ${OpenCV_LIBS})

